package com.partsoft.dits.exts;

import org.springframework.util.Assert;

/**
 * 扩展库信息
 */
public class ExtendsLibraryInfomation implements Cloneable {
	
	public static final String ARG_S_TITLE = "Specification-Title";
	public static final String ARG_S_VERSION = "Specification-Version";
	public static final String ARG_S_VENDOR = "Specification-Vendor";
	public static final String ARG_I_TITLE = "Implementation-Title"; 
	public static final String ARG_I_URL = "Implementation-URL";
	public static final String ARG_I_VERSION = "Implementation-Version";
	public static final String ARG_I_VENDOR = "Implementation-Vendor";
	
	private String name;
	
	private String specificationTitle;
	
	private String specificationVersion;
	
	private String specificationVendor;
	
	private String implementationTitle; 
	
	private String implementationURL;
	
	private String implementationVersion;
	
	private String implementationVendor;
	
	ExtendsLibraryInfomation() {}
	

	public String getName() {
		return name;
	}

	public void setName(String name) {
		Assert.hasText(name);
		this.name = name.toLowerCase();
	}

	public String getSpecificationTitle() {
		return specificationTitle;
	}

	public void setSpecificationTitle(String specificationTitle) {
		this.specificationTitle = specificationTitle;
	}

	public String getSpecificationVersion() {
		return specificationVersion;
	}

	public void setSpecificationVersion(String specificationVersion) {
		this.specificationVersion = specificationVersion;
	}

	public String getSpecificationVendor() {
		return specificationVendor;
	}

	public void setSpecificationVendor(String specificationVendor) {
		this.specificationVendor = specificationVendor;
	}

	public String getImplementationTitle() {
		return implementationTitle;
	}

	public void setImplementationTitle(String implementationTitle) {
		this.implementationTitle = implementationTitle;
	}

	public String getImplementationURL() {
		return implementationURL;
	}

	public void setImplementationURL(String implementationURL) {
		this.implementationURL = implementationURL;
	}

	public String getImplementationVersion() {
		return implementationVersion;
	}

	public void setImplementationVersion(String implementationVersion) {
		this.implementationVersion = implementationVersion;
	}

	public String getImplementationVendor() {
		return implementationVendor;
	}

	public void setImplementationVendor(String implementationVendor) {
		this.implementationVendor = implementationVendor;
	}

	@Override
	public ExtendsLibraryInfomation clone() {
		try {
			return (ExtendsLibraryInfomation) super.clone();
		} catch (CloneNotSupportedException e) {
			return null;
		}
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((name == null) ? 0 : name.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		ExtendsLibraryInfomation other = (ExtendsLibraryInfomation) obj;
		if (name == null) {
			if (other.name != null)
				return false;
		} else if (!name.equals(other.name))
			return false;
		return true;
	}


	@Override
	public String toString() {
		return "ExtendsLibraryInfomation [name=" + name
				+ ", specificationTitle=" + specificationTitle
				+ ", specificationVersion=" + specificationVersion
				+ ", specificationVendor=" + specificationVendor
				+ ", implementationTitle=" + implementationTitle
				+ ", implementationURL=" + implementationURL
				+ ", implementationVersion=" + implementationVersion
				+ ", implementationVendor=" + implementationVendor + "]";
	}

}
